import 'package:flutter/material.dart';

class DDSessionTitle extends StatefulWidget {
  final String title;
  final Color fontColor;
  final Widget child;
  DDSessionTitle(this.title, {this.fontColor = Colors.blue, this.child});

  @override
  _DDSessionTitleState createState() => _DDSessionTitleState();
}

class _DDSessionTitleState extends State<DDSessionTitle> {

  @override
  Widget build(BuildContext context) {
    List<Widget> widgetList = [];
    widgetList.addAll([
      Icon(
        Icons.arrow_right,
        size: 20.0,
        color: widget.fontColor,
      ),
      Text(
        widget.title,
        style: TextStyle(
          color: widget.fontColor,
          fontWeight: FontWeight.bold,
        ),
      ),
    ]);
    if (widget.child != null) {
      widgetList.add(widget.child);
    }

    return Container(
      padding: EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 10.0),
      decoration: BoxDecoration(color: Colors.white),
      child: Row(
        children: widgetList,
      ),
    );
  }
}
